/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package combomodel.auxiliar;

import eloma.classe.auxiliar.Estado;
import java.util.List;
import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;

/**
 *
 * @author Icaro
 */
public class ComboBoxEstadoModel extends AbstractListModel implements ComboBoxModel {

    private List<Estado> listaEstado;
    private Estado selection;

    public ComboBoxEstadoModel(List<Estado> listaEstado) {
        this.listaEstado = listaEstado;
    }

    @Override
    public int getSize() {
        return listaEstado.size();
    }

    @Override
    public Estado getElementAt(int index) {
        return listaEstado.get(index);
    }

    @Override
    public void setSelectedItem(Object anItem) {
        selection = (Estado) anItem;
    }

    @Override
    public Object getSelectedItem() {
        return selection;
    }

}
